var shuju1App = new Vue({
    el:'#shuju1',
    data:{
        user_shuju:'0',
        vip_shuju:'0',
        activity_shuju:'0',
        volunteer_shuju:'0'
    },
    methods:{
        selectUserCount:function () {
            axios.get("/selectUserCount").then(function (response) {
                shuju1App.user_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectVipCount:function () {
            axios.get("/selectVipCount").then(function (response) {
                shuju1App.vip_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectActivityCount:function () {
            axios.get("/selectActivityCount").then(function (response) {
                shuju1App.activity_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectVolunteerCount:function () {
            axios.get("/selectVolunteerCount").then(function (response) {
                shuju1App.volunteer_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
    },
    created:function () {
        console.log("执行了方法");
        this.selectUserCount();
        this.selectVipCount();
        this.selectActivityCount();
        this.selectVolunteerCount();
    }
});

var shuju2App = new Vue({
    el:'#shuju2',
    data:{
        user_shuju:'0',
        vip_shuju:'0',
        nor_shuju:'0',
        activity_shuju:'0',
        volunteer_shuju:'0',
        other_shuju:'0',
        uact_shuju:'0',
    },
    methods:{
        selectUserCount:function () {
            axios.get("/selectUserCount").then(function (response) {
               shuju2App.user_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectVipCount:function () {
            axios.get("/selectVipCount").then(function (response) {
                shuju2App.vip_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectNormalCount:function () {
            axios.get("/selectNormalCount").then(function (response) {
                shuju2App.nor_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectActivityCount:function () {
            axios.get("/selectActivityCount").then(function (response) {
                shuju2App.activity_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectVolunteerCount:function () {
            axios.get("/selectVolunteerCount").then(function (response) {
                shuju2App.volunteer_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        selectOthersCount:function () {
            axios.get("/selectOthersCount").then(function (response) {
                shuju2App.other_shuju = response.data;
            }).catch(function (err) {
                alert(err);
            })
        },
        SelectUactCount:function () {
            axios.get("/selectUactCount").then(function (response) {
                shuju2App.uact_shuju = response.data;
                console.log(response.data);
            }).catch(function (err) {
                alert(err);
            })
        },
    },
    created:function () {
        console.log("执行了方法");
        this.selectUserCount();
        this.selectVipCount();
        this.selectNormalCount();
        this.selectActivityCount();
        this.selectVolunteerCount();
        this.selectOthersCount();
        this.SelectUactCount();
    },
    computed:{
        computerVipProportion:function () {
            if (this.vip_shuju == 0 || this.user_shuju == 0){
                return 0+"%";
            }
            return (Math.round(this.vip_shuju / this.user_shuju * 10000) / 100.00)+"%";
        },
        computerVolunteerProportion:function () {
            if (this.volunteer_shuju == 0 || this.activity_shuju == 0){
                return 0+"%";
            }
            return (Math.round(this.volunteer_shuju / this.activity_shuju * 10000) / 100.00)+"%";
        },
        computerUactProportion:function () {
            if (this.uact_shuju == 0 || this.activity_shuju == 0){
                return 0+"%";
            }
            return (Math.round(this.uact_shuju / this.activity_shuju * 10000) / 100.00)+"%";
        }
    }
});